﻿@model WebApp.ServerModelView
@section css{
    <link href="@Url.Content("~/Content/css/style-server.css")" rel="stylesheet">
 }   
@{
    ViewBag.Title = "Liste des notifications";
    Layout = "~/Views/Shared/_Layout_home.cshtml";
}
    <a href=""><h2>Notifications</h2></a> 
    @if (Model == null)
    {
            <div class="span4" >Aucune Notification ne vous est attribuée.</div>     
    }
    else
    {
        foreach (var notifs_command in Model.Notifications)
        {
            int platchaud = 0;
            var status = "";
            var hot = "";
            var classe = "";
            var mydiv = "N°" + Model.getTablebyTable((Poco.Commande)notifs_command.Commande).Numero; 
            switch (notifs_command.Type.ToString())
            {         
                                              
                case "PlatPret":
                    
                    foreach (var item in notifs_command.Commande.Plat) {
                        List<Poco.Plat> plat = (List<Poco.Plat>)notifs_command.Commande.Plat.ToList();
                        if (Model.getPlat(plat).Type.ToString() == "PlatPrincipal")
                        {
                            platchaud++;                            
                        }
                    }                    
                    status =  "Plat Prêt";
                    classe = "ready";
                   
                    break;
                case "AppelServeur":
                    status = "Demande";
                    classe = "appel";
                    break;
                case "FinRepas":
                    status = "Fin du repas";
                    classe = "appel";
                    break;                    
                case "PlatSuivant":
                    status = "A débarrasser";
                    classe = "appel";
                    break;    
                case "Autre":
                    status = "Autre";
                    classe = "autre";
                    break;
            }
            <div class="span4 notif" >
                <div class="number">@mydiv  - </div> 
                <div class="status @classe">@status</div>                  
                <div class="img">
                   <a href="Serveur/ValidNotif/@notifs_command.Id">
                    <img class="check" src="@Url.Content("~/Content/img/server/check.png")" alt="" />   
                    </a>
                </div>
                @if (platchaud != 0)
                {                
                <div class="img hot">
                    <img class="hot" src="@Url.Content("~/Content/img/server/hot.png")" alt="" />                       
                    <div class="nbchaud">@platchaud</div>
                </div> 
                }                
            </div>

        }    
        <a href="/Serveur/Tables"><h4>Tables</h4></a>    
                   
    }                  